# $Id:
# Maintainer : Martin Wimpress <code@flexion.org>
# Contributor: Jorge Araya Navarro <elcorreo@deshackra.com>
# Contributor: Piotr Beling <qwak@w8.pl>
# Contributor: Vianney le Clément <vleclement AT gmail · com>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - patch to fix build

pkgname=unittestpp
pkgver=1.4
pkgrel=7
pkgdesc="A lightweight unit testing framework for C++"
arch=('i686' 'x86_64')
url="http://unittest-cpp.sourceforge.net/"
depends=('gcc-libs')
source=("https://github.com/unittest-cpp/unittest-cpp/archive/v${pkgver}.tar.gz"
        'unittest++.pc'
        '20_test_runner_bad_virtual_method_arg.dpatch')
md5sums=('f571c054bf6840c9a981a3e9862b5363'
         'fa35c8a0274264dcb75e5106c5b3deb7'
         'b2721cb13e8e74143d05662eba0d97f8')
license=('MIT')
options=('staticlibs')

prepare() {
    cd "${srcdir}/unittest-cpp-${pkgver}"
    patch -p1 -i ../20_test_runner_bad_virtual_method_arg.dpatch
}

build() {
    cd "${srcdir}/unittest-cpp-${pkgver}"
    make all
}

package() {
    install -dm755 "${pkgdir}/usr/lib/pkgconfig"
    install -m644 unittest++.pc "${pkgdir}/usr/lib/pkgconfig"

    cd "${srcdir}/unittest-cpp-${pkgver}"

    install -dm755 "${pkgdir}/usr/include/unittest++/Posix"
    install -m644 src/*.h "${pkgdir}/usr/include/unittest++"
    install -m644 src/Posix/*.h "${pkgdir}/usr/include/unittest++/Posix"

    install -dm755 "${pkgdir}/usr/lib"
    install -m644 libUnitTest++.a "${pkgdir}/usr/lib"
    ln -s libUnitTest++.a "${pkgdir}/usr/lib/libunittest++.a"

    install -dm755 "${pkgdir}/usr/share/licenses/unittestpp"
    install -m644 COPYING "${pkgdir}/usr/share/licenses/unittestpp/LICENSE"
    install -dm755 "${pkgdir}/usr/share/doc/unittestpp"
    install -m644 README "${pkgdir}/usr/share/doc/unittestpp/README"
    install -m644 docs/UnitTest++.html "${pkgdir}/usr/share/doc/unittestpp/UnitTest++.html"
}
